split lines c#

77

read all lines split C# -

List<string[]> list = File.ReadLines("YourFile.txt")
                          .Select(r => r.TrimEnd('#'))
                          .Select(line => line.Split(','))
                          .ToList();

split lines c# -

string[] lines = theText.Split(
    new string[] { "\r\n", "\r", "\n" },
    StringSplitOptions.None
);

array of strings by splitting lines c# -

string[] lines = theText.Split(
    new string[] { Environment.NewLine },
    StringSplitOptions.None
);

Comments

Submit
0 Comments